package com.tequila.bops.controller;

import com.tequila.core.service.AppResourcesService;
import com.tequila.domain.entity.AppResources;
import com.tequila.domain.query.AppResourcesQuery;
import fe.core.ApiResponse;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;


@RestController
@RequestMapping("/appResources")
public class AppResourcesController {

    @Resource
    private AppResourcesService appResourcesService;

    @RequestMapping("/queryPageListByParam")
    public ApiResponse queryPageListByParam(AppResourcesQuery query) {
        return ApiResponse.successApiResponse().withData(appResourcesService.queryPageListByParam(query));
    }

    @RequestMapping("/queryById")
    public ApiResponse queryById(Long id) {
        return ApiResponse.successApiResponse().withData(appResourcesService.queryById(id));
    }

    @RequestMapping("/save")
    public ApiResponse save(AppResources entity) {
        return ApiResponse.successApiResponse().withData(appResourcesService.save(entity));
    }

    @RequestMapping("/update")
    public ApiResponse update(AppResources entity) {
        return ApiResponse.successApiResponse().withData(appResourcesService.updateSelectiveById(entity));
    }
}
